package com.zrrd.jt_admin.order.controller;


import com.zrrd.jt_admin.common.response.ResponseResult;
import com.zrrd.jt_admin.common.page.OrderPageVo;
import com.zrrd.jt_admin.order.service.OrderService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wanjl
 * @since 2024-07-11
 */
@RestController
@RequestMapping("/admin/order")
@ResponseBody
public class OrderController {

    @Resource
    private OrderService orderService;

    @ApiOperation(value = "查询列表", notes = "查询列表")
    @GetMapping("/{page}")
    ///admin/order/:page?limit=[:limit]&tab=[:tab]&no=[:no]&starttime=[:starttime]&endtime=[:endtime]&name=[:name]&phone=[:phone]
    public ResponseResult findByPage(@PathVariable("page") Integer page,
                                     @RequestParam(value = "limit",required = false,defaultValue = "10") Integer limit,
                                     @RequestParam(value = "tab") String tab,
                                     @RequestParam(value = "no",required = false,defaultValue = "") String no,
                                     @RequestParam(value = "starttime",required = false,defaultValue = "") String startTime,
                                     @RequestParam(value = "endtime",required = false,defaultValue = "") String endTime,
                                     @RequestParam(value = "name",required = false,defaultValue = "") String name,
                                     @RequestParam(value = "phone",required = false,defaultValue = "") String phone) {
//        System.out.println(no);
//        System.out.println(startTime);
//        System.out.println(endTime);
        System.out.println(name);
        System.out.println(phone);

        OrderPageVo orderPageVo=orderService.findByPage(page,limit,tab,no,startTime,endTime,name,phone);
        return ResponseResult.queryResponse(orderPageVo);
    }
}

